package net.bolue.console.model;

import java.io.PrintStream;
import java.io.PrintWriter;

import net.bolue.sysmng.exception.BolueException;
import net.bolue.web.mvc.ActionResult;

/**
 * 异常业务处理
 * @author Administrator
 *
 */
public class ExceptionModel extends BusiBase{

	/**
	 * ajax返回
	 * @param exception
	 * @return
	 */
	public ActionResult ajaxResp(BolueException exception){
		if(exception==null){
			return null;
		}
		ActionResult actionResult = new ActionResult();
		Throwable originException = exception.getOriginException();
		if(originException!=null){
			actionResult.setMsg(exception.getMessage()+"\r\n"+originException.getStackTrace());
		}else{
			actionResult.setMsg(exception.getMessage()+"\r\n"+exception.getStackTrace());
		}
		exception.printStackTrace();
		actionResult.setResult(false);
		return actionResult;
	}
}
